package test;
import java.util.Arrays;


public class SelectionSort {
	public static void main(String[] args) {
		int[] arr = {9, 1, 5, 0, 2, 4, 8, 6, 3, 7};
		
		for(int i = 0; i < arr.length - 1; i ++)
		{
			int min = Integer.MAX_VALUE;
			int minIndex = -1;
			for(int j = i; j < arr.length; j ++)
			{
				if(arr[j] < min)
				{
					minIndex = j;
					min = arr[j];
				}
			}
			
			arr[minIndex] = arr[i];
			arr[i] = min;
		}

		System.out.println(Arrays.toString(arr));
	}
}
